var  isAdd=true;//是否新增
var update_condition_data=null;//修改的条件id

//日期格式化
 function myformatter(date){
 	var y = date.getFullYear();
 	var m = date.getMonth()+1;
 	var d = date.getDate();
 	return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
 }
 
 function myparser(s){
 	if (!s) return new Date();
 	var ss = (s.split('-'));
 	var y = parseInt(ss[0],10);
 	var m = parseInt(ss[1],10);
 	var d = parseInt(ss[2],10);
 	if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
 		return new Date(y,m-1,d);
 	} else {
 		return new Date();
 	}
 }

 (function(){
	//加载已选择条件datagrid表格
	$('#condition_datagrid').datagrid({
			fitColumns : false,
			border : true,
			fit : true,
			singleSelect: true,
		    columns: [[
						{ field: 'ffieldname', title: '查询项', width: 100,align:'center',
							formatter: function(value,row,index){
								return '<span title="'+value+'">'+value+'</span>';
							}
					    },
						{ field: 'fid', width: 0,hidden: true},
						{ field: 'ffieldcode', width: 0,hidden: true},
						{ field: 'ffieldtype', width: 0,hidden: true},
						{ field: 'fstandardcode', width: 0,hidden: true},
						{ field: 'fzid', width: 0,hidden: true},
						{ field: 'fsql',width: 0,hidden: true},
						{ field: 'flx',width: 0,hidden: true},
						{ field: 'fshownull',width: 0,hidden: true},
						{ field: 'fexplan',width: 0,hidden: true},
						{ field: 'fsqlzh', title: '查询内容', width: 200,align:'center',
							formatter: function(value,row,index){
								return '<span title="'+value+'">'+value+'</span>';
							}
					    },
						{ field: 'fgx', title: '关系', width: 50,align:'center',
							formatter: function(value,row,index){
								var btn=value==1?"<a class=\"easyui-linkbutton\" onclick=\"updateConditionGX("+index+")\">并且</a>":"<a class=\"easyui-linkbutton\" onclick=\"updateConditionGX("+index+")\">或者</a>";
								return row.fpx!=1?btn:"";
							}
					    },
					    { field: 'fpx', title: '操作', width: 160,align:'center',
							formatter: function(value,row,index){
								var btn='<a class="easyui-linkbutton" onclick="datagridRowMove(\'condition_datagrid\',\'fpx\',true,'+index+')">上移</a>&nbsp;'+
										'<a class="easyui-linkbutton" onclick="datagridRowMove(\'condition_datagrid\',\'fpx\',false,'+index+')">下移</a>&nbsp;'+
										'<a class="easyui-linkbutton" onclick="setConditionItemValue('+index+')">修改</a>&nbsp;'+
										'<a class="easyui-linkbutton" onclick="deleteCondition('+row.fid+','+row.fzid+')">删除</a>';
								return btn;
							}
					    }
					]],
			onDblClickRow:function(index,row){
				setConditionItemValue(index);
			}
		});
	$('.datagrid-wrap').css('border-left',0);
	
	$("div[id][id^='templatediv']").hide(); //id以inputdiv开始的所有div标签
	$("div[id][id^='templatediv']").css('padding-top','10px');

})();
 
/**
 * 病案高级查询-条件-创建条件控件
 * @param filedType 字段类型
 * @param ffieldcode 字段编码
 * @param fstandardcode 统一编码
 * @param zid 组id
 */
function createConditionItem(filedType,ffieldcode,fstandardcode,zid,ffieldname){
	debugger;
	//textboxname属性以inputdiv开始的所有input标签
	$("input[textboxname^='inputdiv']").textbox('setValue', ''); 
	$('#checkValueb'+filedType).attr('checked',false);   //默认摄者单选按钮为false
	
	if(filedType == '9'){
		//获取name为div9removeb的 a标签 
		$("a[name = 'div9removeb']").parent().parent().remove();   //删除之前添加的表格栏
		$("#tempTablediv9 td:last input[textboxname = 'inputdiv9_1b']").combogrid('setValue',''); 
		$("#tempTablediv9 td:last input[textboxname = 'inputdiv9_2b']").combogrid('setValue',''); 
		$("#tempTablediv9 td:last input[textboxname = 'inputdiv9_3b']").combogrid('setValue',''); 
		$("div[id][id^='templatediv']").hide();//id以inputdiv开始的所有div标签
		tempInitoperate();//手术码
		$("#templatediv9").show();
	}else if(filedType == '8'){ 
		$("a[name = 'div8removeb']").parent().parent().remove();   //删除之前添加的表格栏
		$("#tempTablediv8 td:last input[textboxname = 'inputdiv8_1b']").textbox('setValue','');
		$("#tempTablediv8 td:last input[textboxname = 'inputdiv8_2b']").combogrid('setValue',''); 
		$("#tempTablediv8 td:last input[textboxname = 'inputdiv8_3b']").combogrid('setValue',''); 
		$("#tempTablediv8 td:last input[textboxname = 'inputdiv8_4b']").combogrid('setValue',''); 
		$("div[id][id^='templatediv']").hide(); 
		$('#tempTablediv8 td:last input[type="text"]').combogrid({
			panelWidth:500, 
		    mode: 'remote',    
		    url: 'dic/findICD11code', 
		    pagination : true,
		    pageSize: 50,
		    pageList: [50,100],
		    idField: 'FICDM',    
		    textField: 'FICDM',    
		    columns: [[    
				        {field:'FICDM',title:'ICD码',width:150,sortable:true},    
				        {field:'FJBNAME',title:'疾病名称',width:220,sortable:true},  
				        {field:'FZJC',title:'助记词',width:110,sortable:true} 
			    	]]    
		});  
		$.parser.parse($('#templatediv8 td:last'));
		$("#templatediv8").show();
	}else if(filedType == '7'){
		$("div[id][id^='templatediv']").hide(); 
		$.ajax({
			url : "dic/findStandardByCode",
			dataType : 'json',
			type : 'post',
			data : {code:fstandardcode},
			async:false,
			success : function(data){
					$("#temp_span_7").empty();
					for(var i = 0; i<data.length; i++){
						$("#temp_span_7").append("<input type=\"radio\" name=\"sex\" value=\""+data[i].FBH+"\"><span>"+data[i].FMC +"</span> ");	
					}
					$("#temp_span_7").append("<input type=\"radio\" name=\"sex\" value=\"3\"><span>其它</span>");
			},error : errorPromt
		})
		$("#templatediv7").show();
	}else if(filedType == '6'){
		$("div[id][id^='templatediv']").hide(); 
		$("input[name='inputdiv6b']").removeAttr('checked'); 
		$("#templatediv6").show();
	}else if(filedType == '5'){
		$("a[name = 'div5removeb']").parent().parent().remove(); //删除之前添加的表格栏
		$("#tempTablediv5 td:last input[textboxname = 'inputdiv5b']").combobox('select',''); 
		$("div[id][id^='templatediv']").hide();
		if(fstandardcode == null || fstandardcode == ''){
			$("#condition_input_type5").combobox({ 
				editable:false,
				valueField : 'FTYKH',
				textField : 'FKSNAME',
				url:"dic/findTworkroom" 
			}); 
		}else{
			$("#condition_input_type5").combobox({ 
				editable:false,
				valueField : 'FID',
				textField : 'FMC',
				url:"dic/findStandardByCode?code="+fstandardcode+"" 
			}); 
		}
		$("#templatediv5").show();
	}else if(filedType == '4'){
		$("a[name = 'div4removeb']").parent().parent().remove(); //删除之前添加的表格栏
		$("#tempTablediv4 td:last input[textboxname = 'inputdiv4_1b']").textbox('setValue',''); 
		$("#tempTablediv4 td:last input[textboxname = 'inputdiv4_2b']").textbox('setValue',''); 
		$("div[id][id^='templatediv']").hide(); 
		$("#templatediv4").show();
	}else  if(filedType == '3'){     //病案号类型的
		$("a[name = 'div3removeb']").parent().parent().remove();   //删除之前添加的表格栏
		$("div[id][id^='templatediv']").hide(); 
		$("#templatediv3").show();   //把该div显示出来
	}else  if(filedType == '2'){     //病案号类型的
		$("a[name = 'div2removeb']").parent().parent().remove();   //删除之前添加的表格栏
		$("div[id][id^='templatediv']").hide(); 
		$("#templatediv2").show();   //把该div显示出来
	}else if(filedType == '1'){      //文本框类型的	
		$("input[name = 'div1remove']").parent().parent().remove(); //删除之前添加的表格栏
		$("#condition_input_type_1").textbox('setValue','');
		$("div[id][id^='templatediv']").hide(); 
		$("#templatediv1").show();
	}
	$('#condition_name_'+filedType).text(ffieldname);
	isAdd=true;
}

/**
 * 病案高级查询-条件-给条件控件赋值
 * @param index
 */
function setConditionItemValue(index){
	var row=$('#condition_datagrid').datagrid("selectRow",index).datagrid("getSelected");
	update_condition_data=row;
	var type=row.ffieldtype;
	var check=row.fshownull==1?true:false;
	createConditionItem(type,row.ffieldcode,row.fstandardcode,row.zid);
	var arr=row.fexplan.split("@~@");
	
	$("#condition_name_"+type).text(row.ffieldname);
	if(row.ffieldtype == '9'){
		$("#tempTablediv9").find("input[name='inputdiv9_1b']").val(arr[0]);
		$("#tempTablediv9").find("input[name='inputdiv9_2b']").val(arr[1]);
		$("#tempTablediv9").find("input[name='inputdiv9_3b']").val(arr[2]);
		$("#checkValueb"+type).prop("checked",check);
	}else if(row.ffieldtype == '8'){
		$("#tempTablediv8").find("input[name='inputdiv8_1b']").val(arr[0]);
		$("#tempTablediv8").find("input[name='inputdiv8_2b']").val(arr[1]);
		$("#tempTablediv8").find("input[name='inputdiv8_3b']").val(arr[2]);
		$("#tempTablediv8").find("input[name='inputdiv8_4b']").val(arr[3]);
		$("#temp_type8_zdlx").combobox("setValue",row.flx);
		$("#checkValueb"+type).prop("checked",check);
	}else if(row.ffieldtype == '7'){
		 $(":radio[name='sex'][value='"+arr[0]+"']").prop("checked",true);
		 $("#checkValueb"+type).prop("checked",check);
	}else if(row.ffieldtype == '6'){
		 $("input[name=inputdiv6b][value='"+arr[0]+"']").prop("checked",true);  
		 $("#checkValueb"+type).prop("checked",check);
	}else if(row.ffieldtype == '5'){
		$("#tempTablediv5 td:last input[textboxname = 'inputdiv5b']").combobox('select',arr[0]); 
		$("#checkValueb"+type).prop("checked",check);
	}else if(row.ffieldtype == '4'){
		$("#tempTablediv4 td:last input[textboxname = 'inputdiv4_1b']").textbox('setValue',arr[0]); 
		$("#tempTablediv4 td:last input[textboxname = 'inputdiv4_2b']").textbox('setValue',arr[1]); 
		$("#checkValueb"+type).prop("checked",check);
	}else if(row.ffieldtype == '3'){
		$("#tempTablediv3 td:last input[textboxname = 'inputdiv3_1b']").textbox('setValue',arr[0]); 
		$("#tempTablediv3 td:last input[textboxname = 'inputdiv3_2b']").textbox('setValue',arr[1]); 
		$("#checkValueb"+type).prop("checked",check);
	}else if(row.ffieldtype == '2'){
		$("#tempTablediv2 td:last input[textboxname = 'inputdiv2_1b']").textbox('setValue',arr[0]); 
		$("#tempTablediv2 td:last input[textboxname = 'inputdiv2_2b']").textbox('setValue',arr[1]); 
		$("#checkValueb"+type).prop("checked",check);
	}else if(row.ffieldtype == '1'){
		$("#condition_input_type_1").textbox('setValue',arr[0]);
		$("#checkValueb"+type).prop("checked",check);
	}
	isAdd=false;
}
	
/**
 * 病案高级查询-模板条件组--根据模板id获取条件组
 * @param mbid 模板id
 * @returns
 */
function queryCondition(zid){
	$('#condition_datagrid').datagrid('options').url='MedicalCheckManage/queryCondition';
	$('#condition_datagrid').datagrid('options').queryParams={zid:zid};
	$('#condition_datagrid').datagrid("load");
}

/**
 * 
 */
function saveCondition(){
	var node=$('#medical_advanced_inquiry_condition_tree').tree('getSelected');//选择的条件
	var row=$('#medical_advanced_inquiry_condition_group_treegrid').treegrid('getSelected');//选择的条件组
	var type=isAdd?node.attributes.FFIELDTYPE:update_condition_data.ffieldtype;
	var fsqlzh="",fsql="",fexplan="",fshownull="0",flx="0";
	var tcode=isAdd?node.attributes.FTABLECODE:update_condition_data.ftablecode;//表别名
	var fcode=isAdd?node.attributes.FFIELDCODE:update_condition_data.ffieldcode;//字段
	
	if(type == '9'){
		var input1 = $("#tempTablediv9").find("input[name='inputdiv9_1b']").val();
		var input2 = $("#tempTablediv9").find("input[name='inputdiv9_2b']").val();
		var input3 = $("#tempTablediv9").find("input[name='inputdiv9_3b']").val();
		fexplan+=input1+"@~@"+input2+"@~@"+input3;
		fsqlzh="从"+input1+"至"+input2;
		fsql+=tcode+fcode+">='"+input1+"' AND "+tcode+fcode+"<='"+input2+"'";
		if(input3!=""){
			fsql+=" AND "+tcode+fcode+"!='"+input3+"'";
			fsqlzh+="除"+input3;
		}
		if ($("#checkValueb"+type).is(':checked')) { //判断查空值复选框是否选中
			fshownull = '1';
			fsqlzh+="或者为空";
			fsql=fsql+" OR "+tcode+fcode+" IS NULL";
		}
	}else if(8==type){
		var input1 = $("#tempTablediv8").find("input[name='inputdiv8_1b']").val();
		var input2 = $("#tempTablediv8").find("input[name='inputdiv8_2b']").val();
		var input3 = $("#tempTablediv8").find("input[name='inputdiv8_3b']").val();
		var input4 = $("#tempTablediv8").find("input[name='inputdiv8_4b']").val();
		fexplan+=input1+"@~@"+input2+"@~@"+input3+"@~@"+input4;
		fsqlzh="从"+input2+"至"+input3;
		fsql+=tcode+fcode+">='"+input2+"' AND "+tcode+fcode+"<='"+input3+"'";
		if(input4!=""){
			fsql+=" AND "+tcode+fcode+"!='"+input4+"'";
			fsqlzh+="除"+input4;
		}
		if ($("#checkValueb"+type).is(':checked')) { //判断查空值复选框是否选中
			fshownull = '1';
			fsqlzh+="或者为空";
			fsql=" ("+fsql+" OR "+tcode+fcode+" IS NULL) ";
		}
		flx=$("#temp_type8_zdlx").combobox("getValue");
		if(flx!="0" && flx!=""){
			fsql=fsql+" AND "+tcode+"FZDLX="+flx;
		}
	}else if(7==type){
		var value=$("input[name='sex']:checked").val();
		var text=$("input[name='sex']:checked").next("span").text(); 
		fexplan=value;
		fsqlzh="等于"+text;
		fsql=tcode+fcode+"='"+value+"'";
		if ($("#checkValueb"+type).is(':checked')) { //判断查空值复选框是否选中
			fshownull = '1';
			fsqlzh+="或者为空";
			fsql=fsql+" OR "+tcode+fcode+" IS NULL";
		}
	}else if(6==type){
		var value=$("input[name='inputdiv6b']:checked").val();
		var text=$("input[name='inputdiv6b']:checked").next("span").text(); 
		fexplan=value;
		fsqlzh="等于"+text;
		fsql=tcode+fcode+"='"+value+"'";
		if ($("#checkValueb"+type).is(':checked')) { //判断查空值复选框是否选中
			fshownull = '1';
			fsqlzh+="或者为空";
			fsql=fsql+" OR "+tcode+fcode+" IS NULL";
		}
	}else if(5==type){
		var value=$("#condition_input_type5").combobox("getValue"); 
		var text=$("#condition_input_type5").combobox('getText'); 
		fexplan=value;
		fsqlzh="等于"+text;
		fsql=tcode+fcode+"='"+value+"'";
		if ($("#checkValueb"+type).is(':checked')) { //判断查空值复选框是否选中
			fshownull = '1';
			fsqlzh+="或者为空";
			fsql=fsql+" OR "+tcode+fcode+" IS NULL";
		}
	}else if(4==type){
		var input1 = $("#tempTablediv4").find("input[name='inputdiv4_1b']").val();
		var input2 = $("#tempTablediv4").find("input[name='inputdiv4_2b']").val();
		fexplan+=input1+"@~@"+input2;
		fsqlzh="从"+input1+"至"+input2;
		fsql=tcode+fcode+">='"+input1+"' AND "+tcode+fcode+"<='"+input2+"'";
		if ($("#checkValueb"+type).is(':checked')) { //判断查空值复选框是否选中
			fshownull = '1';
			fsqlzh+="或者为空";
			fsql=fsql+" OR "+tcode+fcode+" IS NULL";
		}
	} else if(3==type){
		var input1 = $("#tempTablediv3").find("input[name='inputdiv3_1b']").val();
		var input2 = $("#tempTablediv3").find("input[name='inputdiv3_2b']").val();
		fexplan+=input1+"@~@"+input2;
		fsqlzh="从"+input1+"至"+input2;
		fsql=tcode+fcode+">='"+input1+"' AND "+tcode+fcode+"<='"+input2+"'";
		if ($("#checkValueb"+type).is(':checked')) { //判断查空值复选框是否选中
			fshownull = '1';
			fsqlzh+="或者为空";
			fsql=fsql+" OR "+tcode+fcode+" IS NULL";
		}
	}else if(2==type){
		var input1 = $("#tempTablediv2").find("input[name='inputdiv2_1b']").val();
		var input2 = $("#tempTablediv2").find("input[name='inputdiv2_2b']").val();
		fexplan+=input1+"@~@"+input2;
		fsqlzh="从"+input1+"至"+input2;
		fsql=tcode+fcode+">='"+input1+"' AND "+tcode+fcode+"<='"+input2+"'";
		if ($("#checkValueb"+type).is(':checked')) { //判断查空值复选框是否选中
			fshownull = '1';
			fsqlzh+="或者为空";
			fsql=fsql+" OR "+tcode+fcode+" IS NULL";
		}
	}else if(1==type){
		var input1 = $("#tempTablediv1").find("input[name='inputdiv1b']").val();
		fexplan=input1;
		fsqlzh="等于"+input1;
		fsql=tcode+fcode+"='"+input1+"'";
		if(input1.indexOf("*")!=-1){
			fsqlzh="包含"+input1.replace("*","");
			fsql=tcode+fcode+" LIKE '%"+input1.replace("*","")+"%'";
		}
		if ($("#checkValueb"+type).is(':checked')) { //判断查空值复选框是否选中
			fshownull = '1';
			fsqlzh+="或者为空";
			fsql=fsql+" OR "+tcode+fcode+" IS NULL";
		}
	}
	if(row==null){
		$.messager.alert('提示','请选择条件组','info');
		return ;
	}
	var url="MedicalCheckManage/addCondition";
	var data;
	if(!isAdd){//修改
		url="MedicalCheckManage/updateCondition";
		data={
				fid:update_condition_data.fid,
	 			fsql: fsql,
	 			fsqlzh: fsqlzh,
	 			fshownull: fshownull,
	 			fexplan: fexplan,
	 			flx: flx
	 		};
	}else{//新增
		data={
	 			ftablecode: node.attributes.FTABLECODE,
	 			ftablename: node.attributes.FTABLENAME,
	 			ffieldcode: node.attributes.FFIELDCODE,
	 			ffieldname: node.attributes.FFIELDNAME,
	 			ffieldtype: node.attributes.FFIELDTYPE,
	 			fstandardcode: node.attributes.FSTANDARDCODE,
	 			fstandardtype: node.attributes.FSTANDARDTYPE,
	 			fsql: fsql,
	 			fsqlzh: fsqlzh,
	 			fzid: row.FID,
	 			fshownull: fshownull,
	 			fexplan: fexplan,
	 			flx: flx,
	 			fgx:1
	 		};
	}
		
	$.ajax({
 		url : url,
 		dataType : 'json',
 		type : 'post',
 		data : data,
 		success : function(data){
 			if (data) {
 				$.messager.alert('提示','保存成功','info');
 				//刷新条件明细
 				queryCondition(row.FID);
 			}else{
 				$.messager.alert('提示','保存失败','info');
 			}
 		},error : errorPromt
 	});
}

/**
 * 病案高级查询-条件明细--修改排序
 * @param id
 * @param px
 * @returns
 */
function updateConditionGX(index){
	var row=$('#condition_datagrid').datagrid("selectRow",index).datagrid("getSelected");
	row.fgx=(row.fgx==1||row.fgx=="1")?0:1;
	//更新数据行
	$('#condition_datagrid').datagrid("updateRow",{
		index: index,
		row: row
	});
	//刷新数据行
	$('#condition_datagrid').datagrid("refreshRow",index);
	$.ajax({
		url : "MedicalCheckManage/updateCondition",
		dataType : 'json',
		type : 'post',
		data : {fid : row.fid, fgx: row.fgx},
		success : function(data){
			if (data) {
				//$.messager.alert('提示','操作成功','info');
			}else{
				$.messager.alert('提示','操作失败','info');
			}
		},error : errorPromt
	})
}
/**
 * 病案高级查询-条件-修改排序
 * @param row
 */
function updateConditionPX(row){
	$.ajax({
		url : "MedicalCheckManage/updateCondition",
		dataType : 'json',
		type : 'post',
		data : {fid : row.fid, fpx: row.fpx ,fgx:row.fgx},
		async:false,
		success : function(data){
			if (data) {
				//$.messager.alert('提示','操作成功','info');
			}else{
				$.messager.alert('提示','操作失败','info');
			}
		},error : errorPromt
	})
}

/**
 * 病案高级查询-条件-删除
 * @param fid 条件id
 */
function deleteCondition(fid,fzid){
 	$.ajax({
		url : "MedicalCheckManage/deleteCondition",
		dataType : 'json',
		type : 'post',
		data : {fid: fid},
		success : function(data){
			if (data) {
				$.messager.alert('提示','删除成功','info');
				//重新加载个人模板
				queryCondition(fzid);
			}else{
				$.messager.alert('提示','删除失败','info');
			}
		},error : errorPromt
	})
}


/**
 * 病案高级查询-条件-移动
 * @param datagrid id编号
 * @param sortnum 排序字段名称
 * @param isUp 是否上移
 * @param index 选择下标
 */
function datagridRowMove(datagrid, sortnum, isUp,index) {
    var obj = $('#' + datagrid);
    var toup, todown;
    if (isUp) {//上移
        if (index != 0) {
            toup = obj.datagrid("getData").rows[index];
            todown = obj.datagrid("getData").rows[index - 1];
            todown.fpx=todown.fpx+1;
            toup.fpx=toup.fpx-1;
            toup.fgx=toup.px==1?2:toup.fpx!=1 && (toup.fgx == null || toup.fgx==2)?1:toup.fgx;
            todown.fgx=todown.px==1?2:todown.fpx!=1 && (todown.fgx == null || todown.fgx==2)?1:todown.fgx;
            obj.datagrid("getData").rows[index] = todown;
            obj.datagrid("getData").rows[index - 1] = toup;
            obj.datagrid("refreshRow", index);
            obj.datagrid("refreshRow", index - 1);
        }
    } else {//下移
        var rows = obj.datagrid("getRows").length;
        if (index != rows - 1) {
            todown = obj.datagrid("getData").rows[index];
            toup = obj.datagrid("getData").rows[index + 1];
            todown.fpx=todown.fpx+1;
            toup.fpx=toup.fpx-1;
            toup.fgx=toup.px==1?2:toup.fpx!=1 && (toup.fgx == null || toup.fgx==2)?1:toup.fgx;
            todown.fgx=todown.px==1?2:todown.fpx!=1 && (todown.fgx == null || todown.fgx==2)?1:todown.fgx;
            obj.datagrid("getData").rows[index + 1] = todown;
            obj.datagrid("getData").rows[index] = toup;
            obj.datagrid("refreshRow", index);
            obj.datagrid("refreshRow", index + 1);
        }
    }
    if(undefined!=toup){
    	 updateConditionPX(toup);
    }
    if(undefined!=todown){
   	 	updateConditionPX(todown);
    }
}


/**
 * 病案高级查询-条件-加载icd码下拉框
 */
function tempIniticd(){
	//slice(1,-1) 第二个到倒数第二个元素
	var inputvalue = $('#tempTablediv8 td:last input').combogrid({
		panelWidth:500, 
	    mode: 'remote',    
	    url: 'dic/findICD11code', 
	    pagination : true,//是否显示分页 
	    pageSize: 50,//每页显示的记录条数，默认为10 
	    pageList: [50,100],//可以设置每页记录条数的列表 
	    idField: 'FICDM',    
	    textField: 'FICDM',    
	    columns: [[    
	        {field:'FICDM',title:'ICD码',width:150,sortable:true},    
	        {field:'FJBNAME',title:'疾病名称',width:220,sortable:true},  
	        {field:'FZJC',title:'助记词',width:110,sortable:true} 
	    ]]    
	});  
	$.parser.parse($('#templatediv8 td:last'));
}

/**
 * 病案高级查询-条件-加载手术码
 */
function tempInitoperate(){
	//slice(0,-1) 第一个到倒数第二个元素
	var inputvalue = $('#tempTablediv9 td:last input[type="text"]').combogrid({
		panelWidth:500, 
	    mode: 'remote',    
	    url: 'dic/findTOPERATET', 
	    pagination : true,//是否分页 
	    pageSize: 50,//每页显示的记录条数，默认为10 
	    pageList: [50,100],//可以设置每页记录条数的列表 
	    idField: 'FOPCODE',    
	    textField: 'FOPCODE',    
	    columns: [[    
	        {field:'FOPCODE',title:'ICD码',width:150,sortable:true},    
	        {field:'FOPNAME',title:'疾病名称',width:220,sortable:true},  
	        {field:'FZJC',title:'助记词',width:110,sortable:true} 
	    ]]    
	});  
	$.parser.parse($('#templatediv9 td:last'));
}